package designModel.builder;

public class WuLingCar implements Car {

    private WuLingCar() {
    }

    public static class Builder implements CarBuilder {
        private WuLingCar car;

        public Builder() {
            car = new WuLingCar();
        }

        @Override
        public CarBuilder setColor(String color) {
            car.setColor(color);
            return this;
        }

        @Override
        public CarBuilder setWheel(String wheel) {
            car.setWheel(wheel);
            return this;
        }

        @Override
        public CarBuilder setEngine(String engine) {
            car.setEngine(engine);
            return this;
        }

        @Override
        public CarBuilder setBatteries(String batteries) {
            return this;
        }

        @Override
        public Car build() {
            return car;
        }
    }

    private void setEngine(String engine) {
        System.out.println("引擎:" + engine);
    }

    private void setWheel(String wheel) {
        System.out.println("车轮:" + wheel);
    }

    private void setColor(String color) {
        System.out.println("颜色:" + color);
    }

    @Override
    public void run() {
        System.out.println("跑起来");
    }
}
